{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2\n"
     ]
    }
   ],
   "source": [
    "x = 1\n",
    "print(f'{x+1}')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "**str**\n"
     ]
    }
   ],
   "source": [
    "print('str'.center(7, '*'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1-2-3\n"
     ]
    }
   ],
   "source": [
    "print('-'.join(['1','2','3']))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "str****\n"
     ]
    }
   ],
   "source": [
    "print( 'str'.ljust(7, '*') )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['1', '2', '3', '4']\n"
     ]
    }
   ],
   "source": [
    "print('1,2,3,4'.split(','))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "list2 最大元素值 :  0\n"
     ]
    }
   ],
   "source": [
    "list2 = [0,1,2,3]\n",
    "print (\"list2 最大元素值 : \", min(list2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "列表元素 :  [1, 2, 3, 'G', 'R']\n",
      "列表元素 :  ['I', \"'\", 'm', ' ', 'T', 'o', 'm']\n"
     ]
    }
   ],
   "source": [
    "list1 = list((1,2,3, 'G', 'R'))\n",
    "print (\"列表元素 : \", list1)\n",
    "\n",
    "str1=\"I'm Tom\"\n",
    "list2=list(str1)\n",
    "print (\"列表元素 : \", list2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tuple"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tup3 = \"a\", \"b\", \"c\", \"d\"   #  不需要括号也可以\n",
    "type(tup3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tuple"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tup1 = (50,)\n",
    "type(tup1)     # 加上逗号，类型为元组"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'int'>\n"
     ]
    }
   ],
   "source": [
    "tup1 = (50)\n",
    "print(type(tup1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'one': 'v1', 2: 'v2'}\n",
      "<class 'dict'>\n"
     ]
    }
   ],
   "source": [
    "dict1 = {}\n",
    "dict1['one'] = \"v1\"\n",
    "dict1[2]     = \"v2\"\n",
    "print(str(dict1))\n",
    "print(type(dict1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "dict_items([('Name', 'Runoob'), (2, 7)])\n"
     ]
    }
   ],
   "source": [
    "dict = {'Name': 'Runoob', 2: 7}\n",
    " \n",
    "print (dict.items())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Name : Runoob\n",
      "Age : 7\n"
     ]
    }
   ],
   "source": [
    "dict2 = {'Name': 'Runoob', 'Age': 7}\n",
    "for key,value in dict2.items():\n",
    "    print(key, \":\", value)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "菜鸟教程\n",
      "{'alexa': 10000, 'url': 'www.runoob.com'}\n"
     ]
    }
   ],
   "source": [
    "site= {'name': '菜鸟教程', 'alexa': 10000, 'url': 'www.runoob.com'}\n",
    "pop_obj = site.pop('name')\n",
    "print(pop_obj)\n",
    "print(site)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0  小于 5\n",
      "1  小于 5\n",
      "2  小于 5\n",
      "3  小于 5\n",
      "4  小于 5\n",
      "5  大于或等于 5\n"
     ]
    }
   ],
   "source": [
    "count = 0\n",
    "while count < 5:\n",
    "   print (count, \" 小于 5\")\n",
    "   count = count + 1\n",
    "\n",
    "print (count, \" 大于或等于 5\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
